﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Babylon.js Template</title>

    <style>
        html, body {
            overflow: hidden;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        #renderCanvas {
            width: 100%;
            height: 100%;
            touch-action: none;
        }
    </style>

</head>
<body>

    <canvas id="renderCanvas"></canvas>

    <!-- LIBS -->
    <script src="libs/preview bjs/babylon.max.js" type="text/javascript"></script>
    <script src="libs/cannon.js" type="text/javascript"></script>

    <script src="libs/preview release/babylon.editor.extensions.js" type="text/javascript"></script>

    <!-- MATERIALS -->
    <script src="libs/materials/babylon.simpleMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.skyMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.gradientMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.fireMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.furMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.gridMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.lavaMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.normalMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.terrainMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.triPlanarMaterial.js" type="text/javascript"></script>
    <script src="libs/materials/babylon.waterMaterial.js" type="text/javascript"></script>

    <script src="http://localhost:8000/libs/game.js" type="text/javascript"></script>

    <script type="text/javascript">
        var canvas = document.getElementById("renderCanvas");
        var engine = new BABYLON.Engine(canvas);

        var filesInput = new BABYLON.FilesInput(engine, null, canvas, function () {
            var scene = engine.scenes[0];
            scene.debugLayer.show();

            // Camera
            if (!scene.activeCamera || scene.activeCamera.name === "default camera") {
                var camera = new BABYLON.FreeCamera("Default Camera", new BABYLON.Vector3(15, 15, 15), scene);
                camera.setTarget(BABYLON.Vector3.Zero());

                scene.activeCamera = camera;

                scene.activeCamera.attachControl(canvas);
            }

            // Physics
            if (scene.getPhysicsEngine()) {

            }

            // Extensions
            BABYLON.EDITOR.EXTENSIONS.EditorExtension.ApplyExtensions(scene);

            // Execute scene
            scene.executeWhenReady(function () {
                engine.runRenderLoop(function () {
                    scene.render();
                });

                window.onresize = function () {
                    engine.resize();
                }
            });
        });

        var loadScene = function () {
            filesInput.reload();
        };

        window.onloadeddata();
    </script>

</body>
</html>
